package com.hf.lookatme.zpresenter;

import android.content.Context;
import android.content.Intent;

import com.hf.lookatme.zbean.LoginRecordData;
import com.hf.lookatme.zmodel.IModel_LoginRecordData;
import com.hf.lookatme.zmodel.impls.Model_LoginRecordData;
import com.hf.lookatme.zmodel.loadlistener.OnLoadLoginRecordDataListener;
import com.hf.lookatme.zview.interfaces.IView_Activity_Login;

import java.util.List;

/**
 * Created by JoeShiguang on 2015/5/23.
 */
public class Presenter_Activity_Login implements OnLoadLoginRecordDataListener {

  private IView_Activity_Login iView_activity_login;

  private IModel_LoginRecordData iModel_loginRecordData;


  public Presenter_Activity_Login(IView_Activity_Login iView_activity_login) {

    this.iView_activity_login = iView_activity_login;
    this.iModel_loginRecordData = new Model_LoginRecordData();
  }


  /**
   * 发送Intent
   *
   * @param packageContext
   */
  public void doIntent(Context packageContext, Class<?> cls) {

    Intent intent = new Intent();
    intent.setClass(packageContext, cls);
    packageContext.startActivity(intent);
  }

  public void showPopupWindow_loginRecord(Context context) {

    iModel_loginRecordData.getLoginRecordData(context, this);
  }

  @Override
  public void onLoadLoginRecordDataSuccess(List<LoginRecordData> list_LoginRecordData) {

    iView_activity_login.showPopupWindow_LoginRecord(list_LoginRecordData);
  }

  @Override
  public void onLoadLoginRecordDataFailed(String failedInfo) {


  }
}
